<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客详情</title>
    <link rel="stylesheet" href="./css/common.css">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <link rel="stylesheet" href="editor.md/css/editormd.min.css" />
    <script src="editor.md/lib/marked.min.js"></script>
    <script src="editor.md/lib/prettify.min.js"></script>
    <script src="editor.md/editormd.js"></script>
</head>

<body>
    <!-- 导航栏 -->
    <div class="nav">
        <!-- logo -->
        <img src="./images/logo_003.jpg" alt="">
        <div class="content">
            <span>我的博客系统</span>
            <div class="opts">
                <a href="./blog_list.html">主页</a>
                <a href="./blog_eidt.html">写博客</a>
                <a href="logout">注销</a>
            </div>

        </div>
    </div>
    <!-- 正文部分 -->
    <div class="container">
        <!-- 左边区域 -->
        <div class="container-left">
            <div class="card">
                <img src="./images/nz1.jpeg" alt="">
                <h3></h3>
                <a href="#">Github</a>
                <div class="counter">
                    <span>文章</span>
                    <span>分类</span>
                </div>
                <div class="counter">
                    <span>2</span>
                    <span>1</span>
                </div>
            </div>
        </div>
        <!-- 右边区域 -->
        <div class="container-right">
            <!-- 博客正文 -->
            <div class="blog-content">
                <div class="blog-title">
                </div>
                <div class="blog-datetime">
                </div>
                <div class="content" id = content>
                </div>
            </div>
            <!-- 以上 博客正文 结束 -->
        </div>
    </div>
    <script src="js/app.js"></script>
    <script>
        getLoginStatus();
        function getBlog() {
            $.ajax({
                type: 'get',
                url: 'blog' + location.search,
                success: function(blog){
                    let title = document.querySelector('.container-right .blog-content .blog-title');
                    title.innerHTML = blog.title;

                    let dateDiv = document.querySelector('.container .blog-content .blog-datetime');
                    dateDiv.innerHTML = blog.postTime;

                    // let contentDiv = document.querySelector('.container .content');
                    // contentDiv.innerHTML = blog.content;
                    editormd.markdownToHTML('content', {markdown: blog.content});
                }
            });
        }

        getBlog();

        function getAuthorInfo(){
            $.ajax({
                type: 'get',
                url: 'getAuthorInfo' + location.search,
                success: function(user){
                    let h3 = document.querySelector('.card h3');
                    h3.innerHTML = user.username;
                }
            });
        }

        getAuthorInfo();
    </script>
</body>

</html>